package com.itgaoshu.hospitalproject.mapper;

import com.itgaoshu.hospitalproject.bean.Area;
import com.itgaoshu.hospitalproject.bean.Drugdictionary;
import com.itgaoshu.hospitalproject.bean.Type;
import com.itgaoshu.hospitalproject.bean.Unit;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DrugdictionaryMapper {
    //查询所有药品的方法
    List<Drugdictionary> findAllSdrugdictionary(Drugdictionary drugdictionary);
    //添加药品的方法
    @Insert("insert into drugdictionary values(null,#{drugName},#{unitId},#{sellingPrice},#{areaId},#{typeId})")
    int addSdrugdictionary(Drugdictionary drugdictionary);
    //查询所有产地的方法
    @Select("select * from area")
    List<Area> findAllArea();
    //查询所有计量的方法
    @Select("select * from unit")
    List<Unit> findAllUnit();
    //查询所有类型的方法
    @Select("select * from type")
    List<Type> findAllType();
    //删除药品的方法
    @Delete("DELETE from drugdictionary where drugId=#{drugId}")
    int deleteSdrugdictionary(int drugId);
    //修改药品的方法
    @Update("update drugdictionary set drugName=#{drugName},unitId=#{unitId},sellingPrice=#{sellingPrice},areaId=#{areaId},typeId=#{typeId} where drugId=#{drugId} ")
    int editSdrugdictionary(Drugdictionary drugdictionary);
}

















